<template>
  <div>
    some
  </div>
</template>

<script>
/*
some // 判断有没有符合条件的元素，有就返回true，没有就返回false

*/
export default {
  mounted () {
    this.some()
    this.filter()
    this.concat()
    this.map()
  },
  methods: {
    some () {
      var passed = [12, 5, 8, 1, 4].some( (element, index, array) => ( element >= 10 ) );
      console.log('some', passed)
    },
    filter () {
      var filtered = [12, 5, 6, 8].filter( (ele) => ele >= 8 )
      console.log('filtered', filtered)
      // 过滤出符合条件的元素
    },
    concat () {
      var a = [1, 2]
      var b = JSON.parse(JSON.stringify(a))
      var c = [].concat(a)
      console.log('concat', c === a)
      // 可以用于复制数组 或者 数组拼接
    },
    map () {
      var maper = [{ name: 'a'}, { name: 'b'}].map( ele => ele.name )
      console.log('map', maper)
    }
  },
  computed: {
  }
}
</script>

<style>
</style>

